package com.fandy.struts.SqlStatement;

public class Department {
 
	public   String  getAll()
	{
		return   "select * from Department";
	}
	
	public   String getDepInfoByID(int ID)
	{
		return  "select * from Department where " +com.fandy.struts.Meta.Department.getDepartmentid()+"="+ID;
	}
	
	
	public   String  existDepartment(com.fandy.struts.Model.Department d)
	{
		return  "select count(*) from Department where "
		+com.fandy.struts.Meta.Department.getDepartname()+ " = '"		
		+ d.getdepartname() 
		+ "'";
	}
	
	public String UpdateByID(int id,com.fandy.struts.Model.Department d)
	{
		
		return "update Department set "
		+com.fandy.struts.Meta.Department.getDepartaddress()+"='" + d.getdepartaddress()+"',"		
		+com.fandy.struts.Meta.Department.getDepartname()+"='" +d.getdepartname()+"',"
		+com.fandy.struts.Meta.Department.getManagerid()+ "='"  + d.getmanagerid() + "',"

		+"where "+com.fandy.struts.Meta.Department.getDepartmentid()+"="+id;
		
	}
	
	public String DeleteByID(int id)
	{
		
		return "delete from Department where " + com.fandy.struts.Meta.Department.getDepartmentid() +"="+id;
		
	}
	
	
	
}

